<?php


namespace App\Rpc\api\impl;

use App\Common\Res;
use App\Request\client\WeworkFriendRequest;
use App\Rpc\api\UserInterface;
use App\Service\api\operationService;
use App\Service\api\WeworkFriendService;
use Hyperf\Utils\ApplicationContext;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;


class UserImpl implements UserInterface
{
    /**
     * 获取运营号列表
     * @param array $params
     * @return array
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getAppOperationList(array $params): array
    {
        return ApplicationContext::getContainer()->get(operationService::class)->appOperationList($params);
    }

    /**
     * 获取运营号联系人列表
     * @param array $params
     * @return array
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function getContactsList(array $params): array
    {
        return ApplicationContext::getContainer()->get(operationService::class)->getContactsList($params);
    }

    /**
     * 设置好友备注
     * @param array $params
     * @return array
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function setRemark(array $params): array
    {
        ApplicationContext::getContainer()->get(WeworkFriendRequest::class)->validated($params, 'setRemark');
        return ApplicationContext::getContainer()->get(WeworkFriendService::class)->setRemark($params);
    }

}